HL7 v2 to FHIR System API - Implementation Template
Developer guide
HL7 v2 to FHIR Developer Guide
This is a developer guide generated from source code comments in the DataWeave modules of this application template. The main.dwl file is the entry point of the HL7 v2 to FHIR converter and a good place to start. It uses adt_a01.dwl, oml_o21.dwl, oru_r01.dwl and siu_s12.dwl modules based upon the message type.
| Module | Description |
|---|---|
| account | Maps the account object. |
| address | Maps the FHIR address object. |
| addresstype | Maps the address type object. |
| adt_a01 | This module is responsible for converting an ADT-A01 HL7 message into it's equivalent FHIR format. |
| allergycriticality | Maps the allergy criticality. |
| allergyintolerance | Produces the FHIR Allergy Intolerance object. |
| allergyseverity | Maps the allergy severity. |
| allergytype | Maps the allergy type. |
| appointment | This module is responsible for converting a SIU-S12 HL7 message into a FHIR Appointment object. |
| codeableconcept | Maps the CodeableConcept object. |
| condition | Maps the condition object. |
| contactpoint | Maps the FHIR contact point object. |
| contactpointuse | Maps the FHIR ContactPointUse object. |
| contactrole | Maps the contact role. |
| cq | Maps the CQ quantity object. |
| cx | Maps the CX quantity object. |
| device | Produces the FHIR Device object. |
| diagnosticreport | Produces the FHIR diagnostic report object. |
| driverlicensenumber | Maps the driver license number object. |
| eiidentifier | Maps the EIIdentifier part of a CodeableConcept object. |
| encounter | Produces the FHIR encounter object. |
| error-response | |
| extendedcompositeid | Maps the extended composite ID object. |
| extendedpersonname | Maps the extended person name object. |
| extendedtelecommunicationnumber | Maps the extended telecommunication number object. |
| gender | Maps the gender object. |
| identifier | Maps the FHIR identifier object. |
| idtypes | Maps the ID type object. |
| language | Maps the Language object. |
| location | Maps the FHIR Location object. |
| main | This DataWeave file (main.dwl) is the entry point for the HL7 to FHIR converter. You can add a transform and set the source to this file in order to convert a parsed HL7 message to FHIR. Currently it will parse ADT-A01 and OML-O21 HL7 messages. When producing HL7 input messages, often there are line ending problems. HL7 expects \r (carriage return) as the messaage delimiter but \n or other characters are used/added. To get around this you can use this perl command to replace \n with \r characters on the cli. perl -i -p -e 's/\r/\n/' siu-s12.hl7 |
| maritalstatus | Maps the marital status object. |
| nametype | Maps the name type object. |
| observation | Maps a FHIR Observation object. |
| oml_o21 | This module is responsible for converting an OML-O21 HL7 message into it's equivalent FHIR format. |
| orderstatus | Maps order status object. |
| ordertype | Maps the order type object. |
| oru_r01 | This module is responsible for converting an ORU_R01 HL7 message into it's equivalent FHIR format. |
| patient | Produces the FHIR patient object. |
| physicaltype | Maps the PhysicalType object. |
| practitionerrole | Produces the FHIR PractitionerRole object. |
| priority | Maps the priority object. |
| procedure | Maps the FHIR Procedure object. |
| provenance | Produces the FHIR provenance object. |
| quantity | Maps the FHIR quantity object. |
| range | Maps the FHIR range object. |
| ratio | Maps the FHIR ratio object. |
| registrystatus | Maps the registry status object. |
| relatedperson | Produces the FHIR related person object. |
| relationship | Maps the relationship object. |
| resultstatus | Maps the relationship object. |
| role | Maps the role object. |
| servicerequest | Produces the FHIR service request object. |
| siu_s12 | This module is responsible for converting a SIU-S12 HL7 message into it's equivalent FHIR format. |
| specimen | Produces the FHIR Specimen object. |
| specimenavailability | Maps the specimen available object. |
| telecomequipmenttype | Maps the Telecom Equipment Type object. |
| telecomusecode | Maps the telecom use code object. |
| util | This module defines a number of common utility functions. |
| yes_no | Maps yes/no object. |
account
Maps the account object.
Source:
./src/main/resources/dw/resources/account.dwl
Functions
fun mapAccount (data, id: String)
This function maps the account object with the provided PID object and ID string.
param
datais the PID object.
paramidis a string with the ID to use.
return A FHIR Account formatted object or null if no object provided.
address
Maps the FHIR address object.
Source:
./src/main/resources/dw/resources/datatypes/address.dwl
Functions
fun mapAddress (obj)
Maps the provided object to the FHIR address.
param
objis an object with XAD fields that can be mapped to an address. (ORC-22, RXA-28 ...)
return A FHIR formatted Address object.
addresstype
Maps the address type object.
Source:
./src/main/resources/dw/resources/codesystem/addresstype.dwl
Functions
fun mapAddressType (code)
Maps the provided XAD-07 field to the proper address type object.
param
codeis a XAD-07 field to map.
return An address type object.
adt_a01
This module is responsible for converting an ADT-A01 HL7
message into it's equivalent FHIR format.
Source:
./src/main/resources/dw/resources/adt_a01.dwl
Functions
fun mapA01Message (data: Object)
This function maps the entire A01 message into it's FHIR equivalent.
param
datais an object with the parsed ADTA01 message.
_return An object with the FHIR representation.
allergycriticality
Maps the allergy criticality.
Source:
./src/main/resources/dw/resources/codesystem/allergycriticality.dwl
Functions
fun mapAllergyCriticality (code)
Maps the provided code to the allergy criticality.
param
codeis a string with the criticality code.
return An AllergyCriticality object.
allergyintolerance
Produces the FHIR Allergy Intolerance object.
Source:
./src/main/resources/dw/resources/allergyintolerance.dwl
Functions
fun mapAllergyIntolerance (pid: Object, al1, id: String)
This function produces the FHIR Allergy Intolerance object with the provided PID and AL1 objects and ID string.
param
pidis a PID object.
paramal1is an AL1 object.
paramidis a string with the ID to use.
return A FHIR Allergy formatted object.
fun mapAllergyIntolerance (pid: Object, al1, id: String, patientReference)
This function produces the FHIR Allergy Intolerance object with the provided PID and AL1 objects, ID string, and patient reference string.
param
pidis a PID object.
paramal1is an AL1 object.
paramidis a string with the ID to use.
parampatientReferenceis an optional patient reference to set.
return A FHIR Allergy formatted object.
allergyseverity
Maps the allergy severity.
Source:
./src/main/resources/dw/resources/codesystem/allergyseverity.dwl
Functions
fun mapAllergySeverity (code)
Maps the provided code to the allergy severity.
param
codeis a string with the severity code.
return An AllergySeverity object.
allergytype
Maps the allergy type.
Source:
./src/main/resources/dw/resources/codesystem/allergytype.dwl
Functions
fun mapAllergyType (code)
Maps the allergy type with the provided code.
param
codeis a string with the allergy type code.
return An AllergyType object.
appointment
This module is responsible for converting a SIU-S12 HL7
message into a FHIR Appointment object.
Source:
./src/main/resources/dw/resources/appointment.dwl
Functions
fun mapAppointment (id, obj, pid, nte, ais, serviceNte, aig, aip)
Maps the FHIR Appointment object with the provided SCH HL7 segment.
param
idis a string with the GUID.
paramobjis a SCH segment.
parampidis the PID segment list.
paramnteis a list of NTE segments.
paramaisis a list of AIS segments.
paramserviceNteis a list of NTE segments from the SERVICE node.
paramaigis a list of AIG segments.
paramaipis a list of AIP segments.
return A FHIR formatted Appointment object.
fun getEndTime (ais)
Gets the end datetime for the appointment with the provided AIS segment.
return a formatted date or null if not possible.
fun mapAppointmentStatus (val)
Maps the provided HL7 SCH-25 value to the appropriate FHIR status value.
param
valis the HL7 SCH-25 value.
return the FHIR formatted status value.
fun mapParticipants (obj, pid, ais, aig, aip)
Maps the provided SCH HL7 segment to the participants list for the Appointment object.
param
objis a SCH segment.
parampidis the PID segment list.
paramaisis a AIS segment.
paramaigis a list of AIG segments.
paramailis a list of AIL segments.
paramaipis a list of AIP segments.
return A FHIR formatted list of participant objects.
codeableconcept
Maps the CodeableConcept object.
Source:
./src/main/resources/dw/resources/datatypes/codeableconcept.dwl
Functions
fun mapCodeableConcept (obj)
Maps the provided object into a CodeableConcept object.
param
objis the object to map from.
return A CodeableConcept object.
fun mapCodeableConcept (obj, hasMappingFunct, mappingFunct)
Maps the provided object with the provided mapping function into a CodeableConcept object.
param
objis the object to map from.
paramhasMappingFunctis a boolean with true for has a provided mapping function and false for not. If set to true mappingFunct must be a vaild mapping function reference.
parammappingFunctis a function reference with the function to call to provide the mapping. This function definition must take a single argument.
return A CodeableConcept object.
fun mapCodeableConceptDoMapping (obj, hasMappingFunct, mappingFunct)
This function produces the codeable concept mappings. It's broken out into it's own function so it can be called multiple times from mapCodeableConcept.
param
objis the object to map from.
paramhasMappingFunctis a boolean with true for has a provided mapping function and false for not. If set to true mappingFunct must be a vaild mapping function reference.
parammappingFunctis a function reference with the function to call to provide the mapping. This function definition must take a single argument.
return A CodeableConcept object.
condition
Maps the condition object.
Source:
./src/main/resources/dw/resources/condition.dwl
Functions
fun mapCondition (data, pid, id)
Maps the condition object with the provided DG1 segment.
param
datais a DG1 segment object.
parampidis a PID segment object.
paramidis a string with the ID.
return A object with the mapped Condition or null if no object is provided.
fun mapCondition (data, pid, id, subjectRef)
Maps the condition object with the provided DG1 segment.
param
datais a DG1 segment object.
parampidis a PID segment object.
paramidis a string with the ID.
paramsubjectRefis a string with the optional subject reference.
return A object with the mapped Condition or null if no object is provided.
fun mapConditionSubject (id, ref)
Maps the condition subject object with the provided information.
param
idis a string with the ID.
paramrefis a string with the condition reference.
return An condition object.
fun getOnsetDateTime (dt)
Gets the onset datetime formatted as FHIR datetime or null if no field is provided.
param
dtis the DG1-05 datetime value.
return A FHIR datetime formatted value or null if nothing is provided.
fun getRecordedDate (dt)
Gets the record datetime formatted as FHIR datetime or null if no field is provided.
param
dtis the DG1-19 datetime value.
return A FHIR datetime formatted value or null if nothing is provided.
fun mapConditionIdentifier (data)
Maps the condition identifier with the provided DG1 segment.
param
isa DG1 segment object.
return an identifier array or null if no object is provided.
fun mapVerificationStatus (data)
Maps the verification status with the provided DG1 segment.
param
isa DG1 segment object.
return an identifier array or null if no object is provided.
contactpoint
Maps the FHIR contact point object.
Source:
./src/main/resources/dw/resources/datatypes/contactpoint.dwl
Functions
fun mapContactPoint (obj)
Maps the ORC-23 object to a FHIR contact point object.
param
objis an ORC-23 object to map.
return A FHIR ContactPoint object or null if no object is provided.
fun mapContactPointSystem (code)
Maps the ContactPoint system code with the provided XTN-03 code.
param
codeis the XTN-03 code to map.
return A ContactPoint system code.
contactpointuse
Maps the FHIR ContactPointUse object.
Source:
./src/main/resources/dw/resources/codesystem/contactpointuse.dwl
Functions
fun mapContactPointUse (code)
Maps the provided code value to the proper FHIR ContactPointUse object.
param
codeis a string with the code to map.
return A ContactPointUse obect or null if no field is supplied.
contactrole
Maps the contact role.
Source:
./src/main/resources/dw/resources/codesystem/contactrole.dwl
Functions
fun mapContactRole (code: String)
Maps the contact role with the provided code.
param
codeis a string with the code to map.
return A ContactRole object.
cq
Maps the CQ quantity object.
Source:
./src/main/resources/dw/resources/datatypes/cq.dwl
Functions
fun mapCQ (cq)
Maps the CQ quantity object with the provided TQ1 TQ1-02 object.
param
cqis a TQ1-02 object to map.
return A mapped CQ object.
cx
Maps the CX quantity object.
Source:
./src/main/resources/dw/resources/datatypes/cx.dwl
Functions
fun mapCX (cx)
Maps the CQ quantity object with the provided SPM-31 object.
param
cxis a TQ1-02 object to map.
return A mapped CX object.
device
Produces the FHIR Device object.
Source:
./src/main/resources/dw/resources/device.dwl
Functions
fun mapDevice (prt, id)
This function produces the FHIR Device object with the provided ptr object.
param
prtis the prt device object.
paramidis a string with the ID to use.
return A object with the mapped Device.
diagnosticreport
Produces the FHIR diagnostic report object.
Source:
./src/main/resources/dw/resources/diagnosticreport.dwl
Functions
fun mapDiagnosticReport (orc, obr, obsItem, specimenList, id: String, subjectRef: String)
This function produces the FHIR diagnostic report object with the provided ORC segment.
param
orcis the ORC segment.
paramobris the OBR segment.
paramobsItemis the list of OBS segment.
paramspecimenListis the list of specimen segment.
paramidis a string with the ID to use.
paramsubjectRefis a string with the subjectRef to use.
return A FHIR DiagnosticReport formatted object.
fun mapDiagnosticReportResultReference (obs, id: String)
This function produces the FHIR diagnostic report reason reference object with the provided ref and ID strings.
param
refis a string with the reference.
paramidis a string with the ID to use.
return A FHIR service request reason request formatted object.
fun mapDiagnosticReportspecimenReference (ref, id: String)
This function produces the FHIR diagnostic report reason reference object with the provided ref and ID strings.
param
refis a string with the reference.
paramidis a string with the ID to use.
return A FHIR service request reason request formatted object.
driverlicensenumber
Maps the driver license number object.
Source:
./src/main/resources/dw/resources/datatypes/driverlicensenumber.dwl
Functions
fun mapDriverLicenseNumber (obj)
Maps the driver license number object with the provided PID PID-20 object.
param
objis a PID-20 object.
return A DriverLicenseNumber object.
eiidentifier
Maps the EIIdentifier part of a CodeableConcept object.
Source:
./src/main/resources/dw/resources/datatypes/eiidentifier.dwl
Functions
fun mapEIIdentifier (obj)
Maps the provided object into a CodeableConcept object.
param
objis the object to map from.
return A CodeableConcept object.
encounter
Produces the FHIR encounter object.
Source:
./src/main/resources/dw/resources/encounter.dwl
Functions
fun mapEncounter (data: Object, pv2: Object, pid: Object, id: String)
This function produces the FHIR encounter object with the provided PV1 and PV2 objects.
param
datais the PV1 object.
parampv2is the PV2 object.
parampidis the PID object.
paramidis a string with the ID to use.
return A FHIR Encounter formatted object.
fun mapEncounter (data: Object, pv2: Object, pid: Object, id: String, subjectRef)
This function produces the FHIR encounter object with the provided PV1 and PV2 objects.
param
datais the PV1 object.
parampv2is the PV2 object.
parampidis the PID object.
paramidis a string with the ID to use.
paramsubjectRefis an optional string with the subject reference.
return A FHIR Encounter formatted object.
fun mapEncounterClass (pv1_02)
This function creates the Encounter Class object.
param
pv1_02is the PV1-01 object.
return An Encounter Class object.
fun mapEncounterAccount (pid)
Maps the encounter account reference with the provided PID object.
param
pidis a PID object.
return An array of patient references or null if none are found.
fun mapLocation (data: Object)
This maps the Encounter location with the provided PV1 object.
param
datais the PV1 object.
return A Location object.
fun mapCodeableConceptAdmissionTypes (code)
This function maps the provided code to the appropriate codeableconcept object for Encounter Admission Types. This function is provided as a pointer to mapCodeableConcept.
param
codeis the PV1-04 CWE-01 value.
return A CodeableConcept object.
fun mapCodeableConceptReadmissionIndicator (code)
This function maps the provided code to the appropriate codeableconcept object for Encounter Readmission Indicator. This function is provided as a pointer to mapCodeableConcept.
param
codeis the PV1-13 CWE-01 value.
return A CodeableConcept object.
fun mapCodeableConceptEncounterPriority (code)
This function maps the provided code to the appropriate codeableconcept object for Encounter Priority. This function is provided as a pointer to mapCodeableConcept.
param
codeis the PV2-25 CWE-01 value.
return A CodeableConcept object.
fun mapHopitalization (data: Object)
Maps the PV1 object to the Encounter hospitalization object.
param
datais the PV1 object.
return A hospitalization object.
fun mapParticipant (data: Object, pv2: Object)
Maps the PV1 and PV2 objects to the Encounter participant object.
param
datais the PV1 object.
parampv2is the PV2 object.
return A participant object.
fun mapEncounterIdentifier (data: Object)
Maps the PV1 object to the Encounter identifier object.
param
datais the PV1 object.
return An identifier object.
fun mapPeriod (obj: Object)
Maps the PV1 object to the Encounter period object.
param
datais the PV1 object.
return A period object.
fun mapReasonCode (obj: Object)
Maps the PV1 object to the Encounter reason code list.
param
datais the PV1 object.
return An reasson code list.
fun mapLength (obj: Object)
Maps the PV1 object to the Encounter length object.
param
datais the PV1 object.
return A length object.
fun mapText (obj: Object)
Maps the PV1 object to the Encounter text object.
param
datais the PV1 object.
return A text object.
fun mapEncounterDiagnosis (id, ref)
Maps the encounter diagnosis object with the provided information.
param
idis a string with the ID.
paramrefis a string with the encounter reference.
return An encounter diagnosis object.
error-response
Source:
./src/main/resources/dw/error-response.dwl
extendedcompositeid
Maps the extended composite ID object.
Source:
./src/main/resources/dw/resources/datatypes/extendedcompositeid.dwl
Functions
fun mapExtendedCompositeID (cx)
Maps the extended composite ID object with the provided cx object.
param
cxis a CX object to map.
return An ExtendedCompositeID object.
extendedpersonname
Maps the extended person name object.
Source:
./src/main/resources/dw/resources/datatypes/extendedpersonname.dwl
Functions
fun mapExtendedPersonName (xpn)
Maps the extended person name with the provided XPN object.
param
xpnis an XPN object.
return An ExtendedPersonName object or null if xpn is null.
extendedtelecommunicationnumber
Maps the extended telecommunication number object.
Source:
./src/main/resources/dw/resources/datatypes/extendedtelecommunicationnumber.dwl
Functions
fun mapExtendedTelecommunicationNumber (xtn)
Maps the extended telecommunication number with the provided xtn object.
param
xtnis the provided object to map.
return An ExtendedTelecommunicationNumber object.
gender
Maps the gender object.
Source:
./src/main/resources/dw/resources/codesystem/gender.dwl
Functions
fun mapGender (code)
Maps the gender with the provided code.
param
codeis a string with the code to map.
return A Gender object.
identifier
Maps the FHIR identifier object.
Source:
./src/main/resources/dw/resources/datatypes/identifier.dwl
Functions
fun mapIdentifier (cx)
Maps the provided object to the FHIR identifier object.
param
cxis the input object to map.
return An identifier object.
idtypes
Maps the ID type object.
Source:
./src/main/resources/dw/resources/codesystem/idtypes.dwl
Functions
fun mapIdTypes (code)
Maps the ID type with the provided code.
param
codeis a string with the ID type.
return An IdType object.
language
Maps the Language object.
Source:
./src/main/resources/dw/resources/codesystem/language.dwl
Functions
fun mapLanguage (code)
Maps the provided code to a Language object.
param
codeis a string with the code to map.
return A Language object.
location
Maps the FHIR Location object.
Source:
./src/main/resources/dw/resources/location.dwl
Functions
fun mapLocation (data, id: String)
Maps the FHIR Location object with the provided PV1-03 object.
param
datais a PV1-03 object.
paramidis a string with the ID.
return A FHIR Location object or null if no object provided.
fun mapLocation (data, id: String, orc, rxa)
Maps the FHIR Location object with the provided PV1-03 object.
param
datais a PV1-03 object.
paramidis a string with the ID.
paramorcis an optional argument with the ORC segment object.
paramrxais an optional argument with the RXA segment object.
return A FHIR Location object or null if no object provided.
fun mapLocationIdentifier (data)
Maps the location identifier and returns an array if object is provided and null if not.
param
datais an ORC-21 object.
return An array with the identifier result or null if no object is provided.
main
This DataWeave file (main.dwl) is the entry point for the
HL7 to FHIR converter. You can add a transform and set the
source to this file in order to convert a parsed HL7 message
to FHIR. Currently it will parse ADT-A01 and OML-O21 HL7
messages.
When producing HL7 input messages, often there are line ending
problems. HL7 expects \r (carriage return) as the messaage delimiter
but \n or other characters are used/added. To get around this you
can use this perl command to replace \n with \r characters on
the cli.
perl -i -p -e 's/\r/\n/' siu-s12.hl7Source:
./src/main/resources/dw/main.dwl
maritalstatus
Maps the marital status object.
Source:
./src/main/resources/dw/resources/codesystem/maritalstatus.dwl
Functions
fun mapMaritalStatus (code: String)
Maps the marital status with the provided code.
param
codeis a string with the status.
return A MaritalStatus object.
nametype
Maps the name type object.
Source:
./src/main/resources/dw/resources/codesystem/nametype.dwl
Functions
fun mapNameType (code: String)
Maps the name type with the provided code.
param
codeis a string with the status.
return A NameType object.
observation
Maps a FHIR Observation object.
Source:
./src/main/resources/dw/resources/observation.dwl
Functions
fun mapObservation (data, id)
Maps the provided OBX segment to a FHIR Observation object.
param
datais a HL7 OBX object.
paramidis a string with the ID.
return A FHIR Observation object.
fun mapObservation (data, id, deviceReference)
Maps the provided OBX segment to a FHIR Observation object.
param
datais a HL7 OBX object.
paramidis a string with the ID.
paramdeviceReferenceis an optional device reference string.
return A FHIR Observation object.
fun mapObservation (data, id, deviceReference, subjectReference)
Maps the provided OBX segment to a FHIR Observation object.
param
datais a HL7 OBX object.
paramidis a string with the ID.
paramdeviceReferenceis an optional device reference string.
paramsubjectReferenceis an optional subject reference string.
return A FHIR Observation object.
fun mapObservationSubject (data, id, ref)
Maps the observation subject object with the provided information.
param
datais an OBX object.
paramidis a string with the ID.
paramrefis a string with the observation reference.
return An observation object.
fun mapValueQuantity (data)
Maps the value quantity object with the provided HL7 OBX object.
param
datais a HL7 OBX object.
return A FHIR Observation valueQuantity object.
fun mapValueString (data)
Maps the value string field with the provided HL7 OBX object.
param
datais a HL7 OBX object.
return A valueString field.
fun mapValueCodeableConcept (data)
Maps the codeable concept value with the provided HL7 OBX object.
param
datais a HL7 OBX object.
return A FHIR CodeableConcept object or null if no object is provided.
fun mapValuePeriod (data)
Maps the period value with the provided HL7 OBX object.
param
datais a HL7 OBX object.
return A FHIR period object or null if no object is provided.
fun mapValueDateTime (data)
Maps the datetime value with the provided HL7 OBX object.
param
datais the HL7 OBX object.
return A datetime value or null if no object is provided.
fun mapValueTime (data)
Maps the time value with the provided HL7 OBX object.
param
datais the HL7 OBX object.
return A time value or null if no object is provided.
fun mapValueRatio (data)
Maps the ratio value with the provided HL7 OBX object.
param
datais the HL7 OBX object.
return A ratio value object or null.
fun mapValueRange (data)
Maps the range value with the provided HL7 OBX object.
param
datais the HL7 OBX object.
return A range value object or null.
fun mapInterpretation (data)
Maps the interpretation array with the provided HL7 OBX object.
param
datais the HL7 OBX object.
return An array with the interpretation objects or null.
fun mapObservationInterpretationCode (code)
This function is meant to be passed to mapCodeableConcept and will provide the mapping based upon the provided code.
param
codeis a string with the code to map.
return an object with the mapped code, or null if not found.
fun mapObservationStatus (code)
This function takes the provided code and maps the observation status (codeableconcept).
param
codeis a string with the code to map.
return an object with the mapped code, or null if not found.
fun mapObservationIdentifier (val)
Maps the identifier for observation with the provided OBX-21 field.
param
valis a string with the OBX-21 field.
return A identifier array or null if no value is provided.
fun mapComponent (data)
Maps the component list with the provided OBX object.
param
datais an OBX object.
return A component list or null if no object is provided.
oml_o21
This module is responsible for converting an OML-O21 HL7
message into it's equivalent FHIR format.
Source:
./src/main/resources/dw/resources/oml_o21.dwl
Functions
fun mapO21Message (data: Object)
This function maps the entire O21 message into it's FHIR equivalent.
param
datais an object with the parsed OMLO21 message.
_return An object with the FHIR representation.
orderstatus
Maps order status object.
Source:
./src/main/resources/dw/resources/codesystem/orderstatus.dwl
Functions
fun mapOrderStatus (code)
Maps order status with the provided code.
param
codeis a string with the code to map.
return An OrderStatus object.
ordertype
Maps the order type object.
Source:
./src/main/resources/dw/resources/codesystem/ordertype.dwl
Functions
fun mapOrderType (code)
Maps the order type with the provided code.
param
codeis a string with the code to map.
return An OrderType object.
oru_r01
This module is responsible for converting an ORU_R01 HL7
message into it's equivalent FHIR format.
Source:
./src/main/resources/dw/resources/oru_r01.dwl
Functions
fun mapR01Message (data: Object)
This function maps the entireR01 message into it's FHIR equivalent.
param
datais an object with the parsed ORUR01 message.
_return An object with the FHIR representation.
patient
Produces the FHIR patient object.
Source:
./src/main/resources/dw/resources/patient.dwl
Functions
fun mapPatient (pid, pd1, nk1, id: String)
This function produces the FHIR patient object with the provided PID and NK1 objects.
param
pidis the PID object.
parampd1is the PD1 object.
paramnk1is the NK1 object.
paramidis a string with the ID to use.
return A FHIR Patient formatted object.
physicaltype
Maps the PhysicalType object.
Source:
./src/main/resources/dw/resources/datatypes/physicaltype.dwl
Functions
fun mapPhysicalType (data)
Maps the PL-01 field to the FHIR PhysicalType object.
param
datais the PL-01 field.
return a PhysicalType object or null if no field provided.
practitionerrole
Produces the FHIR PractitionerRole object.
Source:
./src/main/resources/dw/resources/practitionerrole.dwl
Functions
fun mapPractitionerRole (data, id)
Maps the provided PTR segment to a FHIR PractitionerRole object.
param
datais a HL7 PTR object.
paramidis a string with the ID.
return A FHIR Observation object.
fun mapPractitionerRolePeriod (data)
Maps the practitioner role period with the provided PRT object.
param
datais a PRT object.
return A FHIR period object or null if both start and end datetime values are empty.
fun mapPractitionerRoleTelecom (data)
Maps the practitioner role telecom objects with the provided PRT object.
param
datais a PRT object.
return A list of FHIR telecom objects or null if none are found.
priority
Maps the priority object.
Source:
./src/main/resources/dw/resources/codesystem/priority.dwl
Functions
fun mapPriority (code)
Map the priority with the provided code.
param
codeis a string with the code to map.
return A Priority object.
procedure
Maps the FHIR Procedure object.
Source:
./src/main/resources/dw/resources/procedure.dwl
Functions
fun mapProcedure (data, id)
Maps the provided PR1 segment to a FHIR Procedure object.
param
datais a HL7 PR1 object.
paramidis a string with the ID.
return A FHIR Procedure object.
fun mapProcedure (data, id, subjectRef)
Maps the provided PR1 segment to a FHIR Procedure object.
param
datais a HL7 PR1 object.
paramidis a string with the ID.
paramsubjectRefis an optional string with the subject reference.
return A FHIR Procedure object.
fun mapProcedureSubject (ref, id)
Maps the provided reference and ID into a procedure subject object.
param
refis a reference string.
paramidis a string with the ID.
return A FHIR Procedure object.
provenance
Produces the FHIR provenance object.
Source:
./src/main/resources/dw/resources/provenance.dwl
Functions
fun mapProvenance (orc, msh, targetRef: String, whoPatientRef: String, whoDeviceRef: String, whoOrganizationRef: String, id: String)
This function produces the FHIR provenance object with the provided ORC segment.
param
orcis the ORC segment.
paramidis a string with the ID to use.
return A FHIR Provenance formatted object.
quantity
Maps the FHIR quantity object.
Source:
./src/main/resources/dw/resources/datatypes/quantity.dwl
Functions
fun mapCweQuantity (obj)
Maps the provided HL7 object to part of the FHIR quantity object.
param
isan object to map.
return an object with part of the quantity object.
range
Maps the FHIR range object.
Source:
./src/main/resources/dw/resources/datatypes/range.dwl
Functions
fun mapSnRange (obj)
Maps the provided HL7 object to part of the FHIR range object.
param
isan object to map.
return an object with part of the range object or null if provided obj is null.
ratio
Maps the FHIR ratio object.
Source:
./src/main/resources/dw/resources/datatypes/ratio.dwl
Functions
fun mapSnRatio (obj)
Maps the provided HL7 object to part of the FHIR ratio object.
param
isan object to map.
return an object with part of the ratio object or null if the provided obj is null.
registrystatus
Maps the registry status object.
Source:
./src/main/resources/dw/resources/codesystem/registrystatus.dwl
Functions
fun mapRegistryStatus (code)
Maps the registry status with the provided code.
param
codeis a string with the code to map.
return A RegistryStatus object.
relatedperson
Produces the FHIR related person object.
Source:
./src/main/resources/dw/resources/relatedperson.dwl
Functions
fun mapRelatedPerson (pid: Object, nk1, id)
This function produces the FHIR related person object with the provided PID and NK1 objects, and id string.
param
pidis the PID object.
paramnk1is the NK1 object.
paramidis a string with the ID to use.
return A FHIR RelatedPerson formatted object.
fun mapRelatedPerson (pid: Object, nk1, id, patientRef)
This function produces the FHIR related person object with the provided PID and NK1 objects, id string and patient reference string.
param
pidis the PID object.
paramnk1is the NK1 object.
paramidis a string with the ID to use.
parampatientRefis an optional patient reference.
return A FHIR RelatedPerson formatted object.
relationship
Maps the relationship object.
Source:
./src/main/resources/dw/resources/codesystem/relationship.dwl
Functions
fun mapRelationship (code)
Maps the relationship with the provided code.
param
codeis a string with the code to map.
return A Relationship object.
resultstatus
Maps the relationship object.
Source:
./src/main/resources/dw/resources/codesystem/resultstatus.dwl
Functions
fun mapResultStatus (code)
Maps the result status with the provided code.
param
codeis a string with the code to map.
return A ResultStatus object.
role
Maps the role object.
Source:
./src/main/resources/dw/resources/codesystem/role.dwl
Functions
fun mapRole (code)
Maps the role with the provided code.
param
codeis a string with the code to map.
return A Role object.
servicerequest
Produces the FHIR service request object.
Source:
./src/main/resources/dw/resources/servicerequest.dwl
Functions
fun mapServiceRequest (orc, id: String)
This function produces the FHIR service request object with the provided ORC segment.
param
orcis the ORC segment.
paramidis a string with the ID to use.
return A FHIR ServiceRequest formatted object.
fun mapServiceRequest (orc, id: String, subject: String)
This function produces the FHIR service request object with the provided ORC segment, id string and subject string.
param
orcis the ORC segment.
paramidis a string with the ID to use.
paramsubjectis a reference string with the subject.
return A FHIR ServiceRequest formatted object.
fun mapServiceRequest (orc, obr, tq1, obxList, dg1List, id: String, subject: String)
This function produces the FHIR service request object with the provided ORC segment and optional TQ1 segment.
param
orcis the ORC segment.
paramobris an optional OBR segment.
paramtq1is an optional TQ1 segment.
paramobxListis an optional OBX object Array.
paramdg1Listis an optional DG1 object Array.
paramidis a string with the ID to use.
paramsubjectis a reference string with the subject.
return A FHIR ServiceRequest formatted object.
fun mapServiceRequestSupportingInfo (ref: String, id: String)
This function produces the FHIR service request supporting info object with the provided ref and ID strings.
param
refis a string with the reference.
paramidis a string with the ID to use.
return A FHIR service request supporting info formatted patient object.
fun mapServiceRequestReasonReference (ref: String, id: String)
This function produces the FHIR service request reason reference object with the provided ref and ID strings.
param
refis a string with the reference.
paramidis a string with the ID to use.
return A FHIR service request reason request formatted object.
fun mapServiceRequestSpecimen (ref: String, id: String)
This function produces the FHIR service request specimen object with the provided ref and ID strings.
param
refis a string with the reference.
paramidis a string with the ID to use.
return A FHIR service request specimen formatted object.
fun mapServiceRequestIdentifier (orc, obr)
Maps the service request identifier with the provided orc and obr segments.
param
orcis the ORC segment.
paramobris an optional OBR segment.
return An Array with the service request identifier.
siu_s12
This module is responsible for converting a SIU-S12 HL7
message into it's equivalent FHIR format.
Source:
./src/main/resources/dw/resources/siu_s12.dwl
specimen
Produces the FHIR Specimen object.
Source:
./src/main/resources/dw/resources/specimen.dwl
Functions
fun mapSpecimen (spm, id)
This function produces the FHIR Specimen object with the provided order objects.
param
spmis the specimen object.
paramidis a string with the ID to use.
return A object with the mapped specimen.
fun mapSpecimen (spm, obr, id)
This function produces the FHIR Specimen object with the provided order objects.
param
spmis the specimen object.
paramobris the OBR object.
paramidis a string with the ID to use.
return A object with the mapped specimen.
specimenavailability
Maps the specimen available object.
Source:
./src/main/resources/dw/resources/codesystem/specimenavailability.dwl
Functions
fun mapSpecimenAvailability (code)
Maps the role with the provided code.
param
codeis a string with the code to map.
return A specimen available object.
telecomequipmenttype
Maps the Telecom Equipment Type object.
Source:
./src/main/resources/dw/resources/codesystem/telecomequipmenttype.dwl
Functions
fun mapTelecomEquipmentType (code)
Maps the provided XAD-07 field to the proper Telecom Equipment Type object.
param
codeis a XTN-03 field to map.
return An telecom equipment type object or null if not found.
telecomusecode
Maps the telecom use code object.
Source:
./src/main/resources/dw/resources/codesystem/telecomusecode.dwl
Functions
fun mapTelecomUseCode (code: String)
Maps the telecom use code with the provided code.
param
codeis a string with the code to map.
return A TelecomUseCode object.
util
This module defines a number of common
utility functions.
Source:
./src/main/resources/dw/resources/util.dwl
Functions
fun mapGuid (InStr: String)
Generates a GUID with the provided string. This is helpful because the GUID generated is predictable.
param
InStris the input string to the hash function.
return A string with the predictable hashed value.
fun toString (data)
Converts anything to a JSON string representation. Note that if you are serializing an object datetime fields may have local timezone information so this can cause issues with repeatability for munit tests.
param
datais the data type to convert to JSON.
return A JSON formatted string of the provided variable.
fun hl7ConvertDateTime (timeStr)
Converts a HL7 datetime string to the expected datetime string.
param
timeStris a HL7 datetime string formatted YYYYMMDDHHMMSS.
return A timestamp string formatted YYYY-MM-DDTHH:MM:SS.000Z.
fun hl7ConvertDate (dateStr)
Converst a HL7 date to date string.
param
dateStris a HL7 date string formatted YYYYMMDD.
return A date string formatted YYYY-MM-DD.
fun removeNull (arr: Array)
Removes all null items from an array.
param
arris an array.
return An array with null items removed.
fun removeNull (obj: Object)
Removes all null values from an object.
param
objis an object.
return An object with null values removed.
fun clean (obj: Object)
Cleans the provided object of blank strings, null values, empty objects, and empty arrays.
param
objis an Object to clean.
return A cleaned object.
fun clean (arr: Array)
Cleans the provided array of blank strings, null values, empty objects, and empty arrays.
param
arris an Array to clean.
return A cleaned Array.
fun strip (item, key: String)
Recursively strips the provided key name from any objects in the provided item.
param
itemis an value.
paramkeyis a String with the object key name to strip.
return The provided value with any instances of the key removed.
fun toEpochSeconds (str)
Converts the provided HL7 datetime string and converts it to a number with the number of seconds since epoch.
param
stris a HL7 datetime string.
return A number with number of seconds since epoch.
fun fromEpochSeconds (seconds)
Converts the provided datetime as a number with seconds since epoch into the FHIR formatted datetime string.
param
secondsis a number with the seconds since epoch.
return A string with the FHIR formatted datetime string.
fun replacePair (obj: Object, key: String, val)
Replaces a key value pair in an object with the provided object and key value set.
param
objis an object to replace in.
paramkeyis a string to match on.
paramvalis the value to replace with.
return An object with the replaced pair or null if no object is provided.
yes_no
Maps yes/no object.
Source:
./src/main/resources/dw/resources/codesystem/yes_no.dwl
Functions
fun mapYesNo (code)
Maps yesno with the provided code.
param
codeis a string with the code to map.
return A YesNo object.